Fix network bridge script to select the right interface when bridge already exists.
authorcl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>
Thu, 11 May 2006 21:39:44 +0000 (22:39 +0100)
committercl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>
Thu, 11 May 2006 21:39:44 +0000 (22:39 +0100)
If the bridge is already configure, the default route will point
to a xenbr interface and not an eth interface.  Handle this case.

Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
tools/examples/network-bridge

index 377a32636e308788f9d0a256214c415d86595f7b..8c738dce053135a3070ff350aa79550f6f2d02fa 100755 (executable)
@@ -59,7 +59,7 @@ dir=$(dirname "$0")
 findCommand "$@"
 evalVariables "$@"
 
-vifnum=${vifnum:-$(ip route list | awk '/^default / { sub(/eth/,"",$NF); print $NF }')}
+vifnum=${vifnum:-$(ip route list | awk '/^default / { sub(/^(eth|xenbr)/,"",$NF); print $NF }')}
 bridge=${bridge:-xenbr${vifnum}}
 netdev=${netdev:-eth${vifnum}}
 antispoof=${antispoof:-no}